<?php
$this->breadcrumbs = array(
	'凭证列表' => array(
		'index'
	),
	'管理',
);

$this->userActions = array(
	//array('label'=>'List AccountToken', 'url'=>array('index')),
	array(
		'label' => '新建凭证',
		'url' => array(
			'create'
		)
	),
);

?>

<h1>管理凭证</h1>
<div>工作项目：<?php echo AccountTokenProject::getGlobalProjectName(); ?></div>
<?php $this
	->widget('zii.widgets.grid.CGridView',
		array(
			'id' => 'account-token-grid',
			'dataProvider' => $model->search(),
			'filter' => $model,
			'rowCssClassExpression' => '$data->isBalanced()?($row%2?"odd":"even"):"account-token-unbalanced"',
			'columns' => array(
				//'id',
				'tokenDate',
				array(
					'name' => 'tokenYear',
					'filter' => CHtml::listData(
						AccountToken::model()
							->findAll(
								array(
									'select' => 'tokenYear',
									'distinct' => true,
								)), 'tokenYear', 'tokenYear')
				),
				array(
					'name' => 'tokenMonth',
					'filter' => array_combine(range(1, 12), range(1, 12))
				),
				'number',
				'note',
				array(
					'header' => '凭证内容',
					'type' => 'raw',
					'value' => 'CHtml::link($data->itemCount." 条",array("updateItems","id"=>$data->id))'
				),
				array(
					'header' => '总借',
					'type' => 'currency',
					'name' => 'totalDebit',
					'filter' => false,
				),
				array(
					'header' => '总贷',
					'type' => 'currency',
					'name' => 'totalCredit',
					'filter' => false,
				),
				array(
					//'header' => '已平',
					'type' => 'raw',
					'value' => '$data->isBalanced()?"":"X"'
				),
				'createTime',
				/*'createUserId',
				'updateTime',
				
				'updateUserId',
				 */
				array(
					'class' => 'CButtonColumn',
				),
			),
		));
?>
